// 系统运行相关
const APP_NAME = '好赞阅读';
const PORT = process.env.NODE_ENV === 'production' ? 5002 : 5000;
const INIT_DATABASE = false; // 是否初始化数据库

// MONGO数据库
let MONGO_AUTH = false; // 是否开启mongo认知
let MONGO_URL = 'mongodb://127.0.0.1:27017/mbook-v2';
let MONGO_DBNAME = 'mbook-v2';
let MONGO_USER = 'mbook';
let MONGO_PASS = '121960425mbook';
if (process.env.NODE_ENV === 'production') {
  MONGO_AUTH = true;
  MONGO_URL = 'mongodb://127.0.0.1:27017/mbook-v2';
  MONGO_DBNAME = 'mbook-v2';
  MONGO_USER = 'mbook';
  MONGO_PASS = '121960425mbook';
}

// REDIS 链接配置
let REDIS_AUTH = false; // 是否开启Redis认证
let REDIS_HOST = '127.0.0.1';
let REDIS_PORT = '6379';
let REDIS_PASS = '121960425redis';
if (process.env.NODE_ENV === 'production') {
  REDIS_AUTH = true;
  REDIS_HOST = '127.0.0.1';
  REDIS_PORT = '6379';
  REDIS_PASS = '121960425redis';
}

// POSTGRES 连接配置
let DATABASE_HOST = '127.0.0.1';
let DATABASE_PORT = '5432';
let DATABASE_NAME = 'mbook';
let DATABASE_USER = 'mbook';
let DATABASE_PASS = '121960425mbook';
if (process.env.NODE_ENV === 'production') {
  DATABASE_HOST = '127.0.0.1';
  DATABASE_PORT = '5432';
  DATABASE_NAME = 'mbook';
  DATABASE_USER = 'mbook';
  DATABASE_PASS = '121960425mbook';
}

// Jwt
const JWT_SECRET = 'mbook';

// 权限相关
const DOMAIN_WHITE_LIST = ['http://localhost:8080', 'http://localhost:3000']; // 数组中的域名自动加上跨域header
const ADMIN_USERNAME = '海天一色'; // 系统管理员微信名称

// 微信相关
const WX_MINIPROGRAM_APP_ID = 'wx883fa96a6f6461bb'; // 小程序appid
const WX_MINIPROGRAM_SECRET = '63a953b314715a9fb275411615331967'; // 小程序秘钥
const WX_PAY_MCH_ID = '1493983632'; // 微信商户平台API密钥
const WX_PAY_PARTNER_KEY = 'eysEem0uvwHw1y0gQt5D1XhldCW7b78t'; // 微信商户平台API密钥
const WX_PAY_PFX = '../../config/weixin_pay_cert.p12'; // 微信商户平台证书
const WX_PAY_NOTIFY_URL = 'http://ldk.free.ngrok.cc/api/pay/notify'; // 微信异步通知

// const WX_ACCOUNT_APPID = 'wx4c97adb5c9ab29b6'; // 微信公众号APPID
// const WX_ACCOUNT_APP_SECRET = '0166b26c027c7d2c3c2439a9e7a12816'; // 微信公众号秘钥
// const WX_ACCOUNT_TOKEN = 'Z5yzv0ZyPB505sJJJBj51juKZsW5WnI5'; // 微信公众号token
// const WX_ACCOUNT_ENCODING_AES_KEY = 'tmmi4hRi1Nznenn2bJnIGr5f5ZGRM2VG4VH9NhrG6m1'; // 微信公众号消息加密秘钥
// const WX_ACCOUNT_REDIRECT_URL = 'http://mbookv2.lantingshucheng.com/api/wechat/oauth-callback'; // 网页授权回调地址

let WX_ACCOUNT_APPID = 'wx22d164efdd026dea'; // 微信公众号APPID
let WX_ACCOUNT_APP_SECRET = '06e1dc3ff65eeea444b119694a461f12'; // 微信公众号秘钥
let WX_ACCOUNT_TOKEN = 'b814937061d346da'; // 微信公众号token
let WX_ACCOUNT_ENCODING_AES_KEY = 'XAR3Nj7XnDxxdZcHIsZXZiTeyA3nDvqFYVt4lnWEbtu'; // 微信公众号消息加密秘钥
let WX_ACCOUNT_REDIRECT_URL = 'https://fd9801bf0191.ngrok.io/api/wechat'; // 网页授权回调地址
if (process.env.NODE_ENV === 'production') {
  WX_ACCOUNT_APPID = 'wx0409a1ea32f33141';
  WX_ACCOUNT_APP_SECRET = '2b095e0426d34860a1cb89d576e86201';
  WX_ACCOUNT_TOKEN = 'b814937061d346da';
  WX_ACCOUNT_ENCODING_AES_KEY = 'XAR3Nj7XnDxxdZcHIsZXZiTeyA3nDvqFYVt4lnWEbtu';
  WX_ACCOUNT_REDIRECT_URL = 'http://mbookv2.lantingshucheng.com/api/wechat/oauth-callback';
}

// 七牛云
const QINIU_ACCESS_KEY = 'pz1XaE-7IPSWuJjLTrjH3Rv9O5v0hj510O1ttMm6'; // 牛账号的key值，https://portal.qiniu.com/user/key
const QINIU_SECRET_KEY = 'HB_zxxzxJ3YpKFAD3PC7egJvgx4yOp3t6Fg7xdYP';
const QINIU_BUCKET = 'upload'; // 空间名称
const QINIU_CDN_DOMAIN = 'https://file.lantingshucheng.com'; // cdn域名
const QINIU_IS_USE_HTTPS = true; // 配置使用https，并且对应到正确的区域，详情请查考https://github.com/gpake/qiniu-wxapp-sdk/blob/master/READcME.m

// 短信相关
let FAKE_VERTIFICATION = true; // 发送虚假验证码，见日志输出，设置为false则发送真实手机号
if (process.env.NODE_ENV === 'production') {
  FAKE_VERTIFICATION = false;
}

const PIAN_YUN_SECRET = '45b4481e98253a0b1aeb117042de1632'; // 片云设置

// 百度语音合成
const BAIDU_AI_APP_ID = '17900414';
const BAIDU_AI_APP_KEY = 'hfdRZoXGlIAMd1gcFcGpkMoM';
const BAIDU_AI_SECRET_KEY = 'AtHCHZ2A8DUNzWPix5aeOWtIAkS8GldQ';

// 邮件服务器相关
const EMAIL_CONFIG = {
  from: 'andyliwr@outlook.com', // 邮件发出者
  service: 'Outlook365', // 使用了内置传输发送邮件 查看支持列表：https://nodemailer.com/smtp/well-known/
  port: 587,
  secureConnection: true,
  auth: {
    user: 'andyliwr@outlook.com',
    pass: '121960425outlook'
  }
};

// 账号
const USER_INIT_PASSWORD = '12345678';

// 地址
const PROJECT_FRONT_URL = 'https://h5.lantingshucheng.com';
const PROJECT_ADMIN_URL = 'https://admin.lantingshucheng.com/v2';

// 腾讯 cos 文件存储
const TENCENT_COS_CONFIG = {
  secretId: 'AKIDmSyJ7qkkvxoUyKjebNDsLm381iDXbkjY',
  secretKey: 'HPPFtRq61nTy1wgExXwLakjWs8NgXTL3',
  fileServer: {
    picture: {
      Bucket: 'picture-1256514897',
      Region: 'ap-shanghai'
    },
    audio: {
      Bucket: 'audio-1256514897',
      Region: 'ap-shanghai'
    }
  }
};

// 模板消息设置
const TEMPLATE_IDS = {
  book_update: 'kK0I4AQzZTDQNWW38OH--Ddk3RDug9Vq3tlshRnq5ys',
  member_expried: 'BxkScaR5E2uo7pkM1WI1JuIAt2c2iUdIIogJ9ypcTM8'
};

// 登录
const TOKEN_EXPIRED_TIME = '30d'; // 登录 token 有效期

// 其他
const DEBUG_MODE = true; // 是否开启调试模式
const USE_PROXY_IP = false; // 是否使用代理IP，爬虫中使用

export {
  APP_NAME,
  PORT,
  INIT_DATABASE,
  MONGO_AUTH,
  MONGO_URL,
  MONGO_DBNAME,
  MONGO_USER,
  MONGO_PASS,
  REDIS_AUTH,
  REDIS_HOST,
  REDIS_PORT,
  REDIS_PASS,
  DATABASE_HOST,
  DATABASE_PORT,
  DATABASE_NAME,
  DATABASE_USER,
  DATABASE_PASS,
  JWT_SECRET,
  DOMAIN_WHITE_LIST,
  ADMIN_USERNAME,
  WX_MINIPROGRAM_APP_ID,
  WX_MINIPROGRAM_SECRET,
  WX_PAY_MCH_ID,
  WX_PAY_PARTNER_KEY,
  WX_PAY_PFX,
  WX_PAY_NOTIFY_URL,
  WX_ACCOUNT_APPID,
  WX_ACCOUNT_APP_SECRET,
  WX_ACCOUNT_ENCODING_AES_KEY,
  WX_ACCOUNT_TOKEN,
  WX_ACCOUNT_REDIRECT_URL,
  QINIU_ACCESS_KEY,
  QINIU_SECRET_KEY,
  QINIU_BUCKET,
  QINIU_CDN_DOMAIN,
  QINIU_IS_USE_HTTPS,
  FAKE_VERTIFICATION,
  PIAN_YUN_SECRET,
  BAIDU_AI_APP_ID,
  BAIDU_AI_APP_KEY,
  BAIDU_AI_SECRET_KEY,
  DEBUG_MODE,
  USE_PROXY_IP,
  EMAIL_CONFIG,
  USER_INIT_PASSWORD,
  PROJECT_FRONT_URL,
  PROJECT_ADMIN_URL,
  TENCENT_COS_CONFIG,
  TEMPLATE_IDS,
  TOKEN_EXPIRED_TIME
};
